<template>
	<view :style="viewColor" class="wrapper">
		<view class="bag">
			<img :src="`${domain}/static/images/logo_bgh.png`" alt="" srcset="">
		</view>
		<view class="system-height" :style="{ height: statusBarHeight }"></view>
	
		<view class="merchant-msg">
			<img :src="login_logo" />
			<view class="name">
				{{site_name}}
			</view>
		</view>
		<view class="wechat_login">
			<view class="btn-wrapper">
				<!-- #ifdef H5 -->
				<button hover-class="none" @click="wechatLogin" class="bg-theme btn1">绑定公众号身份</button>
				<!-- #endif -->
			</view>
		</view>

	</view> 
</template>

<script>

	const app = getApp();
	let statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
	import editUserModal from '../components/eidtUserModal/index.vue'
	import privacyAgreementPopup from '../components/privacyAgreementPopup/index.vue'
	import { commonAuth } from '@/api/public';
	import { EXPIRES_TIME,	USER_INFO } from '@/config/cache';
	import { getUserInfo,loginMpPhone,getAuthType } from '@/api/user.js';
	import Routine from '@/libs/routine';
	import wechat from '@/libs/wechat';
	import auth from '@/libs/wechat.js';
	import { HTTP_REQUEST_URL } from '@/config/app';
	import { isWeixin,configMap } from "@/utils";
	import Cache from '@/utils/cache';
	import { toLogin } from '@/libs/login.js';
	import { mapGetters } from "vuex";
	export default {
		data() {
			return {
				domain: HTTP_REQUEST_URL,
				isUp: false,
				canClose: true,
				phone: '',
				statusBarHeight: statusBarHeight,
				isHome: false,
				isPhoneBox: false,
				protocol: false,
				isShow: false,
				logoUrl: '',
				code: '',
				codeVal: "",
				authKey: '',
				options: '',
				userInfo: {},
				codeNum: 0,
				canUseGetUserProfile: false,
				canGetPrivacySetting: false,
				inAnimation: false,
				colorStatus: uni.getStorageSync('color_status'),
				mp_is_new: this.$Cache.get('MP_VERSION_ISNEW') || false,
				configData: Cache.get('BASIC_CONFIG'),
				bindPhone: false,
				wechat_phone_switch: 0,
				phone: ''
			};
		},
		computed:{
			...configMap({login_logo:'',site_name: '',first_avatar_switch: ''}, mapGetters(['isLogin','viewColor'])),
		},
		components: {
			editUserModal,
			privacyAgreementPopup
		},
		watch:{	

		},
		onLoad(options) {
			this.phone = options.phone
		},
		onReady(){
		},
		created() {
			
		},
		methods: {
		
			// 公众号登录
			wechatLogin() {
				if(this.phone){
					auth.bangAuth(this.phone);
				} else {
					return this.$util.Tips({
						title: '未绑定手机号'
					})
				}
				
				
			},
		}
	};
</script>

<style lang="scss">
	page {
		background: #fff;
	}
	::v-deep uni-checkbox .uni-checkbox-input,
	::v-deep checkbox .wx-checkbox-input{
		border-radius: 100%;
		width: 30rpx;
		height: 30rpx;
	}
	::v-deep checkbox .uni-checkbox-input.uni-checkbox-input-checked,
	::v-deep checkbox .wx-checkbox-input.wx-checkbox-input-checked {
		border: 2rpx solid var(--view-theme)!important;
		background-color: var(--view-theme)!important;
	}
	.wrapper {
		position: relative;
		height: 100vh;
		.bag {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			opacity: .8;
			z-index: -1;
			/* #ifdef H5 */
			z-index: 0;
			/* #endif */
			img {
				width: 100%;
				height: 838rpx;
			}
		}
		.merchant-msg {
			padding-top: 252rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction: column;
			z-index: 2;
			/* #ifdef H5 */
			position: relative;
			/* #endif */
			img {
				width: 152rpx;
				height: 152rpx;
				border-radius: 50%;
			}
			.name {
				font-size: 40rpx;
				font-weight: 500;
				color: #333333;
				line-height: 56rpx;
				margin-top: 32rpx;
			}
		}
	}
	.wechat_login {
		margin-top: 96rpx;
		.img image {
			width: 100%;
		}
		.btn-wrapper {
			padding: 0 66rpx;
			button {
				width: 100%;
				height: 86rpx;
				line-height: 86rpx;
				margin-bottom: 40rpx;
				border-radius: 120rpx;
				font-size: 30rpx;
				&.btn1 {
					color: #fff;
					background: var(--view-theme);
				}
				&.btn2 {
					color: #666666;
					border: 1px solid #DDDDDD;
				}
			}
		}
	}
	.title-bar {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 34rpx;
		font-weight: 500;
		color: #333333;
		line-height: 48rpx;
	}
	.icon {
		position: absolute;
		left: 30rpx;
		top: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 80rpx;
		height: 80rpx;
		image {
			width: 50rpx;
			height: 50rpx;
		}
	}
	.protocol {
		position: fixed;
		bottom: 52rpx;
		left: 0;
		width: 100%;
		margin: 0 auto;
		color: #999999;
		font-size: 24rpx;
		line-height: 22rpx;
		text-align: center;
		bottom: calc(52rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
		bottom: calc(52rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
		.main-color {
			color: var(--view-theme);
		}
		.trembling {
			animation: shake 0.6s;
		}
	}
</style>